package com.zhoutao.blog.seven.model.converter;

import com.zhoutao.blog.seven.dao.model.BlogCategoryDao;
import com.zhoutao.blog.seven.model.response.BLogCategory;
import com.zhoutao.blog.seven.utils.TimeUtils;
import org.springframework.stereotype.Component;

@Component
public class BlogCategoryConverter extends AbstractConverter<BlogCategoryDao, BLogCategory> {

    @Override
    public BLogCategory converterFrom(BlogCategoryDao blogCategoryDao) {
        BLogCategory category = new BLogCategory();
        category.setId(blogCategoryDao.getId());
        category.setTitle(blogCategoryDao.getTitle());
        category.setIcon(blogCategoryDao.getIcon());
        category.setColor(blogCategoryDao.getColor());
        category.setArticleCount(blogCategoryDao.getArticleCount());
        category.setCreatedAt(TimeUtils.format(blogCategoryDao.getCreatedAt()));
        return category;
    }

    @Override
    public BlogCategoryDao converterTO(BLogCategory bLogCategory) {
        return null;
    }
}
